﻿using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;

namespace System.Peppers.Win32
{
    /// <summary>
    /// Interface for IStream, used in many interop situations
    /// </summary>
    [ComImport, Guid("0000000C-0000-0000-C000-000000000046"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface IStream
    {
        /// <summary>
        /// Required implementation for IStream
        /// </summary>
        /// <param name="buf">??</param>
        /// <param name="len">??</param>
        /// <returns>??</returns>
        int Read([In] IntPtr buf, [In] int len);
        /// <summary>
        /// Required implementation for IStream
        /// </summary>
        /// <param name="buf">??</param>
        /// <param name="len">??</param>
        /// <returns>??</returns>
        int Write([In] IntPtr buf, [In] int len);
        /// <summary>
        /// Required implementation for IStream
        /// </summary>
        /// <param name="dlibMove">??</param>
        /// <param name="dwOrigin">??</param>
        /// <returns>??</returns>
        [return: MarshalAs(UnmanagedType.I8)]
        long Seek([In, MarshalAs(UnmanagedType.I8)] long dlibMove, [In] int dwOrigin);
        /// <summary>
        /// Required implementation for IStream
        /// </summary>
        /// <param name="libNewSize">??</param>
        void SetSize([In, MarshalAs(UnmanagedType.I8)] long libNewSize);
        /// <summary>
        /// Required implementation for IStream
        /// </summary>
        /// <param name="pstm">??</param>
        /// <param name="cb">??</param>
        /// <param name="pcbRead">??</param>
        /// <returns>??</returns>
        [return: MarshalAs(UnmanagedType.I8)]
        long CopyTo([In, MarshalAs(UnmanagedType.Interface)] IStream pstm, [In, MarshalAs(UnmanagedType.I8)] long cb, [Out, MarshalAs(UnmanagedType.LPArray)] long[] pcbRead);
        /// <summary>
        /// Required implementation for IStream
        /// </summary>
        /// <param name="grfCommitFlags">??</param>
        void Commit([In] int grfCommitFlags);
        /// <summary>
        /// Required implementation for IStream
        /// </summary>
        void Revert();
        /// <summary>
        /// Required implementation for IStream
        /// </summary>
        /// <param name="libOffset">??</param>
        /// <param name="cb">??</param>
        /// <param name="dwLockType">??</param>
        void LockRegion([In, MarshalAs(UnmanagedType.I8)] long libOffset, [In, MarshalAs(UnmanagedType.I8)] long cb, [In] int dwLockType);
        /// <summary>
        /// Required implementation for IStream
        /// </summary>
        /// <param name="libOffset">??</param>
        /// <param name="cb">??</param>
        /// <param name="dwLockType">??</param>
        void UnlockRegion([In, MarshalAs(UnmanagedType.I8)] long libOffset, [In, MarshalAs(UnmanagedType.I8)] long cb, [In] int dwLockType);
        /// <summary>
        /// Required implementation for IStream
        /// </summary>
        /// <param name="pStatstg">??</param>
        /// <param name="grfStatFlag">??</param>
        void Stat([In] IntPtr pStatstg, [In] int grfStatFlag);
        /// <summary>
        /// Required implementation for IStream
        /// </summary>
        /// <returns>??</returns>
        [return: MarshalAs(UnmanagedType.Interface)]
        IStream Clone();
    }
}
